package com.cedric.yixianpai.game.cards.Sects.swordCards.c_JinDan;

import com.cedric.yixianpai.game.Constants.CardType;
import com.cedric.yixianpai.game.Constants.Period;
import com.cedric.yixianpai.game.Status.DuelStatus;
import com.cedric.yixianpai.game.interfaces.SwordCard;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

@Component
public class Yun_WuWang extends SwordCard {
    protected int ignor = 0;

    /**
     * title:云剑·无妄
     * effect: 4x2攻 连云：下一次攻击无视防御
     */
    public Yun_WuWang(@Value("1") int lvl) {
        super("云剑·无妄");
        this.setLevel(lvl);
        this.setPeriod(Period.JINDAN);
        this.setDescription("4x2攻 连云：下一次攻击无视防御");

        if (1 == lvl) {
            this.setDamage(4);
            this.ignor = 1;
        } else if (2 == lvl) {
            this.setDamage(6);
            this.ignor = 1;
        } else if (3 == lvl) {
            this.setDamage(8);
            this.ignor = 2;
        } else {
            throw new RuntimeException("Card Level Error!");
        }
    }

    @Override
    public boolean effect(DuelStatus Sta1, DuelStatus Sta2) {
        for (int i = 0; i < 2; i++) {
            Sta1.attack(Sta2, this.getDamage());
        }
        Sta1.getPlayerBuff().clearSwordIntent();
        if (Sta1.lastIs(CardType.YUN)) {
            System.out.println("下" + this.ignor + "次攻击无视防御");
            Sta1.getPlayerBuff().addIgnoreDefense(this.ignor);
        }
        return true;
    }
}
